﻿package mortal.game.resource.tableConfig
{
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.resource.info.*;

    public class CareerConfig extends Object
    {
        private var _map:Dictionary;
        private static var _instance:CareerConfig;

        public function CareerConfig()
        {
            this.init();
            return;
        }// end function

        public function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_career.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:CareerInfo = null;
            var _loc_3:Object = null;
            this._map = new Dictionary();
            for each (_loc_3 in param1)
            {
                
                _loc_2 = new CareerInfo();
                _loc_2.code = _loc_3.code;
                _loc_2.maleBodySize = _loc_3.maleBodySize;
                _loc_2.femaleBodySize = _loc_3.femaleBodySize;
                this._map[_loc_2.code] = _loc_2;
            }
            return;
        }// end function

        public function getBodySize(param1:int, param2:Boolean = true) : int
        {
            var _loc_3:* = this._map[param1];
            if (_loc_3 == null)
            {
                return 0;
            }
            if (param2)
            {
                return _loc_3.maleBodySize;
            }
            return _loc_3.femaleBodySize;
        }// end function

        public static function get instance() : CareerConfig
        {
            if (_instance == null)
            {
                _instance = new CareerConfig;
            }
            return _instance;
        }// end function

    }
}
